/**
 *  @file alphabet.h
 *  @brief Header for alphabet.c (functions for manipulating edge
 *   labels of graphs that represent finite automata).
 *  @author Matthias Stallmann
 *  @date 1992/02/19
 *  $Id: alphabet.h 10 2007-06-28 20:08:57Z mfms $
 */

/*
 *  Copyright (C) 1992, 2001  Matthias Stallmann.
 *  Contact: matt_stallmann@ncsu.edu
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License along
 *  with this program (file COPYING.txt); if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
 *  USA.
 */

char *get_alphabet(void);
/**< no parameters
   returns a pointer to the beginning of the alphabet (so that the
   declaration does not need to be exported */

boolean is_in_label(char c, const char *lab);
/**< parameters:
	 char c;
	 char *lab;
   returns TRUE if c appears in the label lab */

char *label_union(const char *lab1, const char *lab2);
/**< parameters:
     char *lab1,*lab2;
   returns a pointer to an allocated string which contains a list of
   letters and digits that appear in either lab1 or lab2 (items are
   separated by commas for readability */

boolean is_in_alphabet(char c);
/**< parameter:
     char c;
   returns TRUE if c is in the alphabet */

void add_to_alphabet(char c);
/**< parameter:
     char c;
   adds c to the alphabet */

/* !!! Warning: the following macros are rather kludgy -- they depend on
   there not being a conflicting declaration of the character pointer cp_ */
extern const char *cp_;
#define for_in_label(c,lab) if (lab != NULL)\
                              for(cp_ = lab; (c = *cp_) != '\0'; cp_++)\
                                if (is_letter(c) || is_digit(c))
#define for_in_alphabet(c) for(cp_ = get_alphabet(); (c = *cp_) != '\0'; cp_++)

void check_dfa(void);
/**< no parameters
   makes sure graph represents a valid DFA, i.e. that
   there is a unique transition defined for every
   combination of state and alphabet symbol, that there
   are no extraneous symbols;  a side effect is the
   initialization of the alphabet (using an arbitrary
   state as a model) */

/*  [Last modified: 2007 06 28 at 19:36:43 GMT] */
